package cn.org.dian.easycommunicate.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;

public class Theme {
    
    private static List<String> allThemeNames = new ArrayList<String>();
    
    private String name = null;
    /**
     * <termName, term>
     */
    private HashMap<String, Term> allTermsUnderTheme = null;
    
    public Theme() {
        this.allTermsUnderTheme = new LinkedHashMap<String, Term>();
    }
    
    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    public void addTerm(String termName, Term term) {
        this.allTermsUnderTheme.put(termName, term);
        DataCenter.addAllTermName(termName);
    }

    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuffer sb = new StringBuffer();
        sb.append("--Theme: " + name + "\n");
        for (String termName : allTermsUnderTheme.keySet()) {
            sb.append(allTermsUnderTheme.get(termName).toString());
        }
        sb.append("--Theme end\n");
        return new String(sb);
    }

    /**
     * @return the allTermsUnderTheme
     */
    public HashMap<String, Term> getAllTermsUnderTheme() {
        return allTermsUnderTheme;
    }

    public static void addThemeName(String themeName) {
        allThemeNames.add(themeName);
    }
    /**
     * @return the allThemeNames
     */
    public static List<String> getAllThemeNames() {
        return allThemeNames;
    }
    
    
}
